﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using System.IO;
using System.Xml.Serialization;
using System.Diagnostics;

using DanielsGameLibrary;



public class CMap
{
    public List<GameObject> Barriers { get; set; }

    public void load(string filename, ContentManager content)
    {


        MapData data= content.Load<MapData>(filename);
        

        Barriers = new List<GameObject>();
        foreach (MapObject i in data.content)
        {

            Barrier e = new Barrier();
            e.LoadContent(content, data.models[i.type]);
            Vector3 v = new Vector3(i.Pos.X, i.Pos.Z, -i.Pos.Y);
            e.Position = v;
            Barriers.Add(e);
        }
    }

    public void Draw(Camera cam, bool enablecliping, Vector4 clipingplane, GraphicsDevice graphics)
    {
        foreach (GameObject i in Barriers)
        {
            i.Draw( cam, enablecliping, clipingplane, graphics);
            //i.dibugdraw(graphics, cam);
        }
    }

    public List<Movable> getMovabals()
    {
        List<Movable> output = new List<Movable>();
        foreach (GameObject i in Barriers)
        {
            output.Add(i);
        }
        return output;
    }
}
